<?php



require "database.php";


require "../config/config.php";

$base=new Db($__conf__);

$post=$_POST;

$hz=md5(date("YmdHis").mt_rand(100000,999999));

$user=$base->doSql('select * from tp_user where token="'.$post["uid"].'"');
if (!$user) {
	return json([
		"code"=>400,
		"msg"=>"System Error",
		"requestDate"=>date("Y-m-d H:i:s"),
		"data"=>null
	]);
}


// tp_hezuo
$r=$base->doSql('insert into tp_hezuo set code="'.$hz.'",addtime="'.time().'",uid="'.$user[0]["id"].'"');

if ($r) {
	return json([
		"code"=>200,
		"msg"=>"Successful",
		"requestDate"=>date("Y-m-d H:i:s"),
		"data"=>[
			"code"=>$hz
		]
	]);
}else{
	return json([
		"code"=>400,
		"msg"=>"System Error",
		"requestDate"=>date("Y-m-d H:i:s"),
		"data"=>null
	]);
}
